package com.example.back.mapper;

import com.example.back.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface UserMapper {

    @Insert("insert into user(yhm,pwd,phone,email,sex,zcsj,tx,nc,ip,drb) values(#{yhm},#{pwd},#{phone},#{email},#{sex},#{zcsj},#{tx},#{nc},#{ip},#{drb})")
    int addUser(User user);

    @Delete("delete from user where id=#{id}")
    int deleteUser(Integer id);
    @UpdateProvider(type = UserMapperProvider.class, method = "getUpdateUserSql")
    int updateUser(User user);
   @Select("select * from user where yhm=#{yhm} and pwd=#{pwd}")
    User selectUser(User user);
   @Select("select * from user where id= #{id}")
    User queryUserById(Integer id);
    @SelectProvider(type = UserMapperProvider.class, method = "getSelectUsersSql")
    ArrayList<User> selectUsers(User user);
    @Select("select * from user where yhm=#{yhm}")
    User queryUserByYhm(String yhm);
    @Select("select * from user where phone= #{phone}")
    User queryUserByPhone(String phone);
}
